// cnpm install socket.io express
const http = require("http");
const express = require("express");
const socketIo = require("socket.io");
const app = express();
const httpServer = http.createServer(app);
const io = socketIo(httpServer);// 创建一个基于webSocket的服务
io.on("connection",function(socket){
	console.log("连接socket服务",socket.id);
	socket.on("one",function(a,b,c,d){
		console.log("one",a,b,c,d);
		io.emit("two",100,200,300);
	})
	socket.on("disconnect",function(){
		console.log("断开连接",socket.id);
	})
})
app.use(express.static(__dirname));
httpServer.listen(80,function(){
	console.log("success");
})